package io.kiki.sba.registry.server.clientInterface.remoting.console;

import io.kiki.sba.registry.api.ChannelHandler;
import io.kiki.sba.registry.api.exchange.DataExchanger;
import io.kiki.sba.registry.server.clientInterface.bootstrap.Config;
import io.kiki.sba.registry.server.shared.remoting.ClientSideExchanger;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Collection;
import java.util.Collections;

public class SessionConsoleExchanger extends ClientSideExchanger {

    @Autowired
    private Config config;

    public SessionConsoleExchanger() {
        super(DataExchanger.SESSION_SERVER_CONSOLE_TYPE);
    }

    @Override
    protected Collection<ChannelHandler> getClientHandlers() {
        return Collections.emptyList();
    }

    @Override
    public int getRpcTimeoutMillis() {
        return 3000;
    }

    @Override
    public int getServerPort() {
        return config.getConsolePort();
    }

    @Override
    public int getConnNum() {
        return 2;
    }


    public void setSessionServerConfig(Config config) {
        this.config = config;
    }
}
